<template>
    <el-select placeholder="请选择频道" clearable :value='value'  @change="fn">
      <el-option :label="item.name" :value="item.id" v-for='item in channelsList' :key='item.id'></el-option>
    </el-select>
</template>

<script>
import { getChannels } from '@/api/articles'
export default {
  name: 'channel',
  async created () {
    const res = await getChannels()
    this.channelsList = res.data.channels
    // console.log('获取频道信息', this.channelsList)
  },
  props: ['value'],
  data () {
    return {
      channelsList: []
    }
  },
  methods: {
    fn (val) {
      this.$emit('input', val)
    }
  }
}
</script>

<style>

</style>
